home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq15.zip / LOGON.SLT < prev    next >
Text File  |  1991-01-31  |  28KB  |  791 lines

  1. //-----------------------------------------------------------
  2. // LOGON.SL? Automatic logging into any BBS.
  3.  
  4. str upload  [] = "UPLOAD"      // Name of upload script.
  5.    ,grabmail[] = "GRABMAIL"    // Name of GrabMail script.
  6.    ,dnload  [] = "DNLOAD"      // Name of download script.
  7.    ,mailup  [] = "MAILUP"      // Name of mail upload script.
  8.    ;
  9.  
  10. //-----------------------------------------------------------
  11. // Please look at the comments through the whole file, and modify to
  12. // suit your needs before you use it. Then recompile with CS LOGON.
  13. // Modify your dialing directory as follows: linked script should be
  14. // set to LOGON, and your password should be set to whatever it is.
  15. //-----------------------------------------------------------
  16.  
  17. str bbs_type [32]              // BBS type.
  18.    ,bbs_name [32]              // BBS name.
  19.    ,User     [32]              // Your own name.      
  20.    ,logfile  [32]              // Log file name.  
  21.    ,shortname[ 8]              // BBS name,
  22.    ,codename [ 8]              // ID-code,
  23.    ,help     [80]              // For various help
  24.    ,Sdoor     [2]              // PCB door (ASCII)
  25.    ,lline [60]                 // Read last line.
  26.    ,check  [4]                 // For checking "short" globals.
  27.    ,show    []="DISPLAY"       // Script to display logoff/exit status
  28.    ,global  []="GLOBAL"        // Name of Global script.
  29.    ,bbsname []="BNAME"         // Global containing BBS name.
  30.    ,cname   []="CNAME"         // Codename for current BBS.
  31.    ,bbstype []="BTYPE"         // BBS type.
  32.    ,mscript []="MDOOR"         // Mail script/door.
  33.    ,short   []="SHORT"         // Shortened BBS name.
  34.    ,conf    []="CONF"          // Current conference.
  35.    ,username[]="NAME"          // User name
  36.    ,dpass   []="DPASS"         // Default password
  37.    ,passw   []="PASSW"         // Current password
  38.    ,graph   []="GRAPH"         // Graphics: YES or NO.
  39.    ,cprot   []="CPROT"         // Current protocol.
  40.    ,hprot   []="HPROT"         // "His" protocol.
  41.    ,version []="PCBVER"        // PCB version.
  42.    ,logoff  []="LOGOF"         // Auto-Logof setting.
  43.    ,status  []="STATUS"        // Line number of status line.
  44.    ,changed []="CHANGE"        // Status line changed.
  45.    ;
  46.  
  47. int tol = 300            // No activity for 30 seconds
  48.    ,stat, tmark          // makes script time out. 
  49.    ,pcb                  // 1 for PCBoard, 2 for ProLogon, otherwise 0.
  50.    ,mbbs, rbbs           // TRUE for MBBS / RBBS
  51.    ,opus, fido, crcs     // TRUE for corresponding system.
  52.    ,PCBver               // PCB version no.
  53.    ,y                    // Y coordinate for writing on screen.
  54.    ,pw1                  // Trig for password request
  55.    ;
  56.  
  57. //-----------------------------------------------------------
  58. // Script starts here.
  59. //-----------------------------------------------------------
  60.                                
  61. main()
  62. {
  63. int c, error, i, l, na;
  64. int pcb1, pcb2, pcb3                     // Trigs for various PCBs
  65.    ,more
  66.    ,ohd
  67.    ,WantGrab
  68.    ;
  69.  
  70. // Only if the Global script is loaded.
  71. //-----------------------------------------------------------
  72.  
  73.   if (!is_loaded(global))                // If Global script is not
  74.   { clear_scr();
  75.     box (13,7,62,14,176,1,15);
  76.     box (15,8,60,13,177,1,15);
  77.     box (17,9,58,12,178,1,15);
  78.     pstraxy ("  Sorry - the LOGON script only works   ",18,10,79);
  79.     pstraxy (" if you execute the Qdial script first! ",18,11,79);
  80.     gotoxy (0,20);
  81.     failtone();
  82.     goto end2;
  83.   }
  84.  
  85. // Start all tracking at once - just in case something takes long.
  86.  
  87.   pcb1 = track ("age # to use",0);       // Check for PCboard / ProLogon
  88.   pcb2 = track ("roLogon",0);   
  89.   pcb3 = track ("now active",0);
  90.   opus = track ("OPUS",0);               // Check for OPUS BBS
  91.   more = track ("--more--",0);           // Check for the "more" prompt
  92.   ohd  = track ("Hard Disco", 1);        // Cut OHD's crap.
  93.   na = track ("ur first name", 1);       // Request for name.
  94.  
  95.   bbs_name = _entry_name;
  96.   i = strposi (bbs_name,"D:",0);         // Find "D:" in string.
  97.   if (i < 0) 
  98.     i = strlen (bbs_name);               // Not found: Use length.
  99.  
  100.   for (--i; i>1; --i) 
  101.     if (subchr (bbs_name,i)!=' ') break; // Delete trailing spaces.
  102.   setchr (bbs_name,i+1,0);               // This is last character.   
  103.   y = 1;
  104.   display (bbs_name,0,12);               // Write it on the screen.
  105.   i = strlen (bbs_name);
  106.   y = display (" answered. ",i,12);
  107.  
  108. // Extract the first 8 alphabetic characters
  109. // to get the short name.
  110.  
  111.   c = 0;
  112.   error=strlen (bbs_name);
  113.   for (i=0; (error=subchr (bbs_name,i)) > 0; ++i) 
  114.   { if (isalpha(error=toupper(error))) 
  115.     { setchr (shortname,c,error);
  116.       ++c;
  117.       if (c > 7) break;
  118.     }
  119.   }
  120.   setchr (shortname,c,0);                // End string.
  121.   write (short,shortname);               // Enter short name into global.
  122.   logfile = "LOG\";                      // Logfile directory.
  123.   strcat (logfile,shortname);
  124.  
  125.   stat = capture_stat();                 // Check capture file status.
  126.  
  127.   if (stat) 
  128.     capture ("*CLOSE*");
  129.  
  130.   y = display("Opening log file... ",0,15);
  131.   fdelete (logfile);                     // Delete previous file.
  132.   if(capture(logfile) < 0)
  133.     y = display("LOG FILE NOT OPENED! ",0,15);
  134.   else
  135.   { i = display ("Capturing into ",0,15);
  136.     y = display (_capture_fname,15,62); 
  137.   }
  138.  
  139.   entry ();                              // Update colors & status bar. 
  140.  
  141.   write (bbsname,bbs_name);              // Write BBS name to global.
  142.   read (status,check);
  143.   i = stoi (check);                      // Find status line.         
  144.   terminal();
  145.   pstraxy ("                           ",0,i,116);
  146.   pstraxy (bbs_name,1,i,116);            // Write BBS name on status line.  
  147.   gotoxy (0,++y);                        // Move back up.
  148.  
  149. // Only if online.
  150.  
  151.   i = 0;
  152.   while (!carrier())
  153.   { delay(1);
  154.     if (++i > 10)
  155.     if (!carrier())
  156.     { failtone();
  157.       release();
  158.       status_wind ("THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
  159.       return (-1);
  160.     }
  161.   }
  162.   goodtone();
  163.  
  164.   write (changed,"YES");                 // Make "display" update status
  165.   call (show);                           // line - Telix destroyed it.
  166.  
  167.   bbs_type="MBBS";                       // set MBBS type (default) 
  168.  
  169.   if (strlen(_entry_pass) > 0)
  170.     lline = _entry_pass;
  171.   else
  172.     read (dpass,lline);                  // Get default password.
  173.  
  174.   write (passw,lline);                   // Set current password.
  175.  
  176.   read (username,User);                  // Get the user name.
  177.   i = strlen (User);
  178.   setchr (User,i,13);                    // Add a CR.
  179.  
  180.   _zmod_auto = 1;                        // Set auto download to true
  181.   set_defprot ('Z');                     // Set default protocol (Zmodem)
  182.  
  183.   pcb=mbbs=rbbs=opus=fido=crcs=0;        // System not defined yet!
  184.  
  185.   tmark = timer_start (tol);             // Gimme more time.
  186.   error = 1;
  187.  
  188.   while ((stat=trig()) > 0)              // Exit on first trig.
  189.   { if (stat == ohd)                     // check for OHD.
  190.       cputs ("^K^K^K");                  // Cut the crap.
  191.      
  192.     else if (stat == more)               // More?
  193.       cputs ("N^M");                     // No thanx!
  194.     else
  195.       release();                         // Release tracks and timer.
  196.  
  197.     if (stat==pcb1 || stat==pcb2         // Check for PCBoard.
  198.     ||  stat==pcb3)
  199.     { bbs_type = "PCB";
  200.       pcb = 1;
  201.       if (stat==pcb2) ++pcb;             // Set correct PCBoard type.
  202.       break;                             // 1=PCBoard, 2=ProLogon      
  203.     }
  204.     else if (stat == opus)               // check for OPUS
  205.     { bbs_type = "OPUS";                 // Log on using OPUS script.
  206.       opus = 1;
  207.       break;
  208.     }
  209.     else if (stat == fido)               // check for FIDO
  210.     { bbs_type = "FIDO";                 // Log on using FIDO script.
  211.       fido = 1;
  212.       break;
  213.     }
  214.     else if (stat == crcs)               // check for CRCS
  215.     { bbs_type = "CRCS";                 // Log on using CRCS script.
  216.       crcs = 1;
  217.       break;
  218.     }
  219.     else if (st